package com.tuanzi.loan.business.repository.sms;

import com.tuanzi.loan.business.entity.sms.SmsCalculateTask;
import com.tuanzi.loan.business.entity.sms.SmsCalculateTaskStatus;
import com.tuanzi.loan.business.repository.sms.custom.SmsCalculateTaskRepositoryCustom;
import com.tuanzi.loan.business.service.sms.vo.SmsSearchResponse;
import com.tuanzi.loan.vo.request.family.SmsCondition;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.Date;
import java.util.List;

public interface SmsCalculateTaskRepository extends SmsCalculateTaskRepositoryCustom, JpaRepository<SmsCalculateTask, Long> {

	Long countByStatus(SmsCalculateTaskStatus status);

	Long countByStatusIn(List<SmsCalculateTaskStatus> status);

	SmsCalculateTask findTopByStatus(SmsCalculateTaskStatus status);
	
	SmsCalculateTask findTopByStatusAndCalculateTimeBeforeOrderByCalculateTime(SmsCalculateTaskStatus status, Date date);

	List<SmsSearchResponse> listSmsUser(SmsCondition request);

    List<SmsCalculateTask> findAllByIdIn(List<Long> ids);
}
